<?php 
require_once('../model/class.comment.php');
$qiComment = new qiComment($DB);

if($ts == 'list')
{
$pageurl = '';
$page = isset($_GET['page']) ? abs(intval($_GET['page'])) : 1;
$pageurl .= './index.php?action=comment&ts=list&page';
$comms = $qiComment->getAllComms($page,8);

$virtue = "id";
$setvirtue = "id";
$commnum = $qiComment->getCommNum($virtue, $setvirtue);

$page_url = pagination($commnum, 8, $page, $pageurl);
}

if($ts == 'edit')
{
$commid = $_GET['id'];
$commDate = $qiComment->getOneComm($commid);
}

if($ts == 'update')
{
$commid = $_GET['id'];
$content = $_POST['content'];

$commDate = array(
'content' => $content
);

$qiComment->updateComm($commDate,$commid);
header("Location: index.php?action=comment&ts=list");
}

if($ts == 'del')
{
$commid = $_GET['id'];
$qiComment->deleteComm($commid);
header("Location: index.php?action=comment&ts=list");
}


?>